const _base: string = '/apis';
export const baseApp: string = '/app';
// const _base = process.env.NODE_ENV === 'production' ? "/apis" : "http://suzamdsltlab002:8090";
export const baseApi: string = _base;


/**
 * apk升级包校验key
 */
export const APP_CONFIG_KEY = "android-proxy";


/**
 * 平台、设备和操作系统 ，返回true或false,true表示是移动端，false表示不是移动端
 */
function _isMobile(): boolean {
  var mobileArray: Array<string> = ["iPhone", "iPad", "Android", "Windows Phone", "BB10; Touch", "BB10; Touch", "PlayBook", "Nokia"];
  var ua: string = navigator.userAgent;
  return mobileArray.findIndex(key => {
    return ua.indexOf(key) > 0;
  }) >= 0;
}

export const isMobile: boolean = _isMobile();
/**
 * 根据不同的平台设置不同的token
 */
export const tokenName: string = _isMobile() ? 'APP_order_management_token' : 'PC_order_management_token';


/**
 * 放行请求路径
 */
export const excludesRequestPath: Array<string> = [
  `${_base}/api/apk/user/login`,
  `${_base}/api/apk/shift`,
  `${_base}/api/apk/user/signup`
];

// /**
//  * 放行Router路径
//  */
// export const excludesRouterPath: Array<string> = [
//   `/layout/login`,
//   ``,
//   ``,
// ];

/**
 * 放行Router路径
 */
export const excludesRouterName: Array<string> = [
  `welcome`,
  `login`,
  `register`,
];

export type RequestCode = {
  code: number
  data: any
  msg: String
}
